Skip to content

Add a new fromInputStream(InputStream, Long) overload that uses an SD…#6868

Merged
zoewangg merged 1 commit intomasterfrom
zoewang/sdkManagedInputStreamExecutor
Apr 20, 2026
Merged

Add a new fromInputStream(InputStream, Long) overload that uses an SD…#6868
zoewangg merged 1 commit intomasterfrom
zoewang/sdkManagedInputStreamExecutor

Conversation

@zoewangg
Copy link
Copy Markdown
Contributor

Motivation and Context

AsyncRequestBody.fromInputStream currently requires customers to provide their own ExecutorService. This is a common source of misconfiguration — undersized or shared executors lead to degraded performance or request timeouts. This change adds a simpler overload that lets the SDK manage threading internally.

Modifications

  • Added AsyncRequestBody.fromInputStream(InputStream, Long) overload that uses an SDK-managed shared cached thread pool
  • Made executor optional in AsyncRequestBodyFromInputStreamConfiguration (previously required via Validate.paramNotNull)
  • InputStreamWithExecutorAsyncRequestBody falls back to a lazily-initialized shared executor when none is provided
  • Updated javadoc on the existing 3-arg overload to reference the new simpler API
  • Parameterized existing unit tests to cover all three creation paths
  • Added S3 integration test for the SDK-managed executor path

Testing

  • Parameterized InputStreamWithExecutorAsyncRequestBodyTest covers customer-provided executor, 2-arg overload, and builder-without-executor paths (data copy + error
    forwarding)
  • PutObjectIntegrationTest.putObject_fromInputStreamWithSdkManagedExecutor_shouldSucceed validates round-trip upload/download with content verification
  • One-off tests verifying threads are being terminated after idle timeout.
  • Added unit tests
  • Ran existing tests
  • Manual testing performed

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn clean install -pl :sdk-core succeeds for affected modules
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@zoewangg zoewangg requested a review from a team as a code owner April 16, 2026 16:10
@zoewangg zoewangg added the api-surface-area-approved-by-team Indicate API surface area introduced by this PR has been approved by team label Apr 16, 2026
@sonarqubecloud
Copy link
Copy Markdown

@zoewangg zoewangg added this pull request to the merge queue Apr 20, 2026
Merged via the queue into master with commit 617c8bb Apr 20, 2026
50 of 52 checks passed
@github-actions
Copy link
Copy Markdown

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api-surface-area-approved-by-team Indicate API surface area introduced by this PR has been approved by team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants